#ifndef ClassManager_First
#define ClassManager_First
#ifdef __GNUG__
#pragma interface
#endif

#include "Object.h"

class Iterator;
class OrdCollection;

//---- ClassManager ------------------------------------------------------------

class ClassManager: public Object {
public:
	MetaDef(ClassManager);
	ClassManager();
	~ClassManager();

	//---- class table management
	OrdCollection *GetClassTable();
	void Add(Class*);
	bool Remove(Class*);
	Iterator *Iterator();
	Class *Find(const char *name, double version= 0.0);
	Class *FindOrLoad(const char *name, double version= 0.0);
	Object *Load(const char *module, const char *cla);

	//---- misc
	void SetupSubclasses();
	void InstanceStatistics(bool cumSorted= FALSE);

protected:
	OrdCollection *sortClassTable();

protected:
	OrdCollection *classTable;
	bool sorted;
};

extern ClassManager *gClassManager;

#endif

